﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DelegateAndEvent
{
    //定义委托
    public delegate int Buy(string name);
    class DelegateBuy
    {


        public int BuyApple(string name)
        {
            Console.WriteLine("{0}买苹果",name);
            return 10;
        }
        public int BuyOrange(string name)
        {
            Console.WriteLine("{0}买橙子", name);
            return 20;
        }

        public void WhoBuy(string name, Buy buy)
        {
            buy(name);

        }
    }
}
